
    <template>
  <div class="auth-bg">
    <div class="auth-card">
      <div class="auth-logo">
        <el-icon :size="48" color="#409EFF"><Platform /></el-icon>
        <h1>找回密码</h1>
        <p class="subtitle">请输入注册邮箱，我们将发送验证码给您</p>
      </div>

      <el-form :model="form" @submit.prevent="handleSendCode" class="auth-form">
        <el-form-item>
          <el-input
            v-model="form.email"
            prefix-icon="Message"
            placeholder="example@domain.com"
            size="large"
            clearable
          />
        </el-form-item>

        <el-button
          type="primary"
          size="large"
          native-type="submit"
          :loading="loading"
          style="width: 100%"
        >
          发送验证码
        </el-button>

        <div class="auth-footer">
          <el-link type="primary" @click="$router.push('/login')">
            返回登录
          </el-link>
        </div>
      </el-form>
    </div>
  </div>
</template>
  
  
  <script setup>
  import { ref } from 'vue'
  import { ElMessage } from 'element-plus'
  import { useRouter } from 'vue-router'
  import request from '@/api/index'
  const form = ref({ email: '' })
  const loading = ref(false)
  const router = useRouter()
  
  const handleSendCode = async () => {
  if (!form.value.email) return ElMessage.warning('请输入邮箱')
  loading.value = true
  try {
    await request.post('/auth/forgot', { email: form.value.email })
    ElMessage.success('验证码已发送，请查收邮件')
    router.push({ name: 'Reset', query: { email: form.value.email } })
  } catch (e) {
    ElMessage.error(e?.response?.data?.message || '发送失败')
  } finally {
    loading.value = false
  }
}
  </script>
  <style scoped>
    .auth-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo h1 {
  margin: 8px 0 4px;
  font-size: 26px;
  color: #333;
}

.subtitle {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.auth-form .el-button {
  height: 46px;
  border-radius: 8px;
  font-size: 16px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .auth-card {
    margin: 0 10px;
    padding: 30px 20px;
  }
}

  </style>